package cc;

import java.io.IOException;
import java.sql.SQLException;

import org.apache.http.client.ClientProtocolException;

import com.bootdo.common.wx.WeiXinUtil;

public class cnmsss {
	
	public static void main(String[] args) throws ClientProtocolException, IOException, SQLException {
//		  String accessToken =WeiXinUtil.getOauth2AccessToken2("wxcb74c2a7fb1fd161", "3ba771e951e1e0e917b7dcd777a25e06");
//	         String strurl="https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token="+accessToken;
//	         String responeJsonStr = "{";
//	         responeJsonStr += "\"touser\": \"" + "oLIwp5rKXaKKnrYRrdn7OtsevNOA" + "\",";
//	         responeJsonStr += "\"msgtype\": \"miniprogrampage\",";
//	         responeJsonStr += "\"miniprogrampage\": {";
//	         responeJsonStr += "  \"title\": \"" + "ceshi" + "\",";
//	         responeJsonStr += "  \"appid\": \"" + "wx798d61260ba95d82" + "\",";
//	         responeJsonStr += "  \"pagepath\": \"" + "pages/index/index" + "\",";
//	         responeJsonStr += "  \"thumb_media_id\": \"" + "Wr8SVx7Dgzgll4I2-xlgj84IOkQgei0zD6ELjRIf8Dw" + "\"";
//	         responeJsonStr += "}";
//	         responeJsonStr += "}";
//			  System.out.println(responeJsonStr);
//			  xstream2.connectWeiXinInterface(strurl,responeJsonStr);
		SendQYMessageimg2();
	}
	
    public static  void SendQYMessageimg() throws ClientProtocolException, IOException, SQLException
    {
//          String Url="http://****/view/addetails.html?id="+id;
		  String accessToken =WeiXinUtil.getOauth2AccessToken2("wxcb74c2a7fb1fd161", "3ba771e951e1e0e917b7dcd777a25e06");
         String strurl="https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token="+accessToken;
         String responeJsonStr = "{";
         responeJsonStr += "\"touser\": \"" + "oLIwp5rKXaKKnrYRrdn7OtsevNOA" + "\",";
         responeJsonStr += "\"msgtype\": \"news\",";
         responeJsonStr += "\"news\": {";
         responeJsonStr += "\"articles\": [{";
         responeJsonStr += "  \"title\": \"" + "ceshi" + "\",";
         responeJsonStr +=	"  \"description\": \"" + "description" + "\",";
         responeJsonStr += "  \"url\": \"" + "" + "\",";
         responeJsonStr += "  \"picurl\": \"" + "" + "\",";
         responeJsonStr += "}]";
         responeJsonStr += "}";
         responeJsonStr += "}";
		  xstream4.connectWeiXinInterface(strurl,responeJsonStr);
 
    }
    
    public static  void SendQYMessageimg2() throws ClientProtocolException, IOException, SQLException
    {
//          String Url="http://****/view/addetails.html?id="+id;
		  String accessToken =WeiXinUtil.getOauth2AccessToken2("wxcb74c2a7fb1fd161", "3ba771e951e1e0e917b7dcd777a25e06");
         String strurl="https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token="+accessToken;
         String responeJsonStr = "{";
         responeJsonStr += "\"touser\": \"" + "oLIwp5rKXaKKnrYRrdn7OtsevNOA" + "\",";
         responeJsonStr += "\"msgtype\": \"text\",";
         responeJsonStr += "\"text\": {";
         responeJsonStr += "  \"content\": \"" + "sss" + "\",";
         responeJsonStr += "}";
         responeJsonStr += "}";
         
         System.out.println(responeJsonStr);
		  xstream4.connectWeiXinInterface(strurl,responeJsonStr);
 
    }

}
